<template>
  <div class="flink-job-logs">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="page-title">
        <div class="title-with-back">
          <el-button 
            type="primary" 
            :icon="ArrowLeft" 
            @click="goBack"
            class="blue-return-button"
            circle
          />
          <div class="title-content">
            <div class="title-main">
              <el-icon class="title-icon"><DataLine /></el-icon>
              <h2>Flink Job 日志统计</h2>
            </div>
            <p class="page-description">
              <el-icon><Document /></el-icon>
              <span>按类维度分析日志，包含类健康度、错误监控、趋势分析等</span>
            </p>
          </div>
        </div>
      </div>
    </div>

    <!-- 时间范围选择器 -->
    <el-card class="filter-card">
      <template #header>
        <div class="card-header">
          <span><el-icon><Timer /></el-icon> 时间范围</span>
          <el-button @click="refreshData" :icon="Refresh" size="small" :loading="loading">刷新</el-button>
        </div>
      </template>
      <div class="time-selector">
        <div class="time-quick-buttons">
          <el-button 
            :class="['time-btn', 'time-btn-all', { 'active': selectedTimeRange === 'all' }]"
            @click="selectTimeRange('all')"
            size="default"
          >
            全部
          </el-button>
          <el-button 
            :class="['time-btn', 'time-btn-1h', { 'active': selectedTimeRange === '1h' }]"
            @click="selectTimeRange('1h')"
            size="default"
          >
            1小时
          </el-button>
          <el-button 
            :class="['time-btn', 'time-btn-1d', { 'active': selectedTimeRange === '1d' }]"
            @click="selectTimeRange('1d')"
            size="default"
          >
            1天
          </el-button>
          <el-button 
            :class="['time-btn', 'time-btn-3d', { 'active': selectedTimeRange === '3d' }]"
            @click="selectTimeRange('3d')"
            size="default"
          >
            3天
          </el-button>
          <el-button 
            :class="['time-btn', 'time-btn-7d', { 'active': selectedTimeRange === '7d' }]"
            @click="selectTimeRange('7d')"
            size="default"
          >
            7天
          </el-button>
        </div>
        <div class="custom-time-selector">
          <el-date-picker
            v-model="dateRange"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            format="YYYY-MM-DD"
            value-format="YYYY-MM-DD"
            @change="handleCustomTimeChange"
            style="width: 280px;"
          />
          <el-time-picker
            v-model="startTime"
            placeholder="开始时间"
            format="HH:mm:ss"
            value-format="HH:mm:ss"
            @change="handleCustomTimeChange"
            style="width: 120px;"
          />
          <span style="color: #909399;">至</span>
          <el-time-picker
            v-model="endTime"
            placeholder="结束时间"
            format="HH:mm:ss"
            value-format="HH:mm:ss"
            @change="handleCustomTimeChange"
            style="width: 120px;"
          />
        </div>
      </div>
    </el-card>

    <!-- 概览卡片 -->
    <el-row :gutter="20" class="overview-row" v-loading="loading">
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon logs">
              <el-icon><Document /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-value">{{ overview.total_logs?.toLocaleString() || 0 }}</div>
              <div class="stat-label">日志总量</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon jobs">
              <el-icon><Grid /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-value">{{ overview.warn_count || 0 }}</div>
              <div class="stat-label">警告数</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon errors">
              <el-icon><CircleClose /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-value">{{ overview.error_count || 0 }}</div>
              <div class="stat-label">错误数</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon rate">
              <el-icon><WarningFilled /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-value">{{ overview.error_rate || 0 }}%</div>
              <div class="stat-label">错误率</div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <!-- 类健康度排行和日志趋势 -->
    <el-row :gutter="20">
      <el-col :span="8">
        <el-card class="job-health-card" v-loading="loading">
          <template #header>
            <div class="card-header">
              <span><el-icon><TrendCharts /></el-icon> 类健康度排行</span>
            </div>
          </template>
          <el-table :data="classHealth" style="width: 100%" max-height="350">
            <el-table-column prop="class_name" label="类名" min-width="150" show-overflow-tooltip />
            <el-table-column prop="total_logs" label="日志数" width="80" align="right">
              <template #default="scope">
                {{ formatNumber(scope.row.total_logs) }}
              </template>
            </el-table-column>
            <el-table-column prop="error_count" label="错误数" width="80" align="right" />
            <el-table-column prop="health_status" label="状态" width="70" align="center">
              <template #default="scope">
                <el-tag 
                  :type="getHealthTagType(scope.row.health_status)"
                  size="small"
                >
                  {{ getHealthLabel(scope.row.health_status) }}
                </el-tag>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="16">
        <el-card class="trend-chart-card" v-loading="loading">
          <template #header>
            <div class="card-header">
              <span><el-icon><DataLine /></el-icon> 日志趋势（{{ trendGranularityLabel }}）</span>
            </div>
          </template>
          <div ref="trendChartRef" style="width: 100%; height: 350px;"></div>
        </el-card>
      </el-col>
    </el-row>

    <!-- 错误分析 -->
    <el-card class="errors-card" v-loading="loading">
      <template #header>
        <div class="card-header">
          <span><el-icon><WarningFilled /></el-icon> {{ errorAnalysisTitle }}（Top 20）</span>
          <div class="level-tabs">
            <el-button 
              :type="selectedLogLevel === 'ERROR' ? 'danger' : 'default'"
              :class="{ 'level-active': selectedLogLevel === 'ERROR' }"
              size="small"
              @click="switchLogLevel('ERROR')"
            >
              ERROR
            </el-button>
            <el-button 
              :type="selectedLogLevel === 'WARN' ? 'warning' : 'default'"
              :class="{ 'level-active': selectedLogLevel === 'WARN' }"
              size="small"
              @click="switchLogLevel('WARN')"
            >
              WARN
            </el-button>
            <el-button 
              type="info"
              :class="{ 'level-active': selectedLogLevel === 'EXCEPTION', 'exception-btn': selectedLogLevel === 'EXCEPTION' }"
              size="small"
              @click="switchLogLevel('EXCEPTION')"
            >
              EXCEPTION
            </el-button>
          </div>
        </div>
      </template>
      <el-table :data="errors" style="width: 100%" max-height="400" :key="selectedLogLevel">
        <el-table-column prop="class_name" label="类名" width="220" show-overflow-tooltip />
        <el-table-column prop="class_path" label="类路径" width="350" show-overflow-tooltip />
        <el-table-column prop="error_count" :label="logCountLabel" width="110" align="right" sortable :resizable="false">
          <template #default="scope">
            <span style="white-space: nowrap;">{{ scope.row.error_count }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="last_error_time" label="最后发生时间" width="180" :resizable="false">
          <template #default="scope">
            <span style="white-space: nowrap;">{{ scope.row.last_error_time }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="message" :label="logMessageLabel" min-width="400" show-overflow-tooltip />
      </el-table>
      <el-empty v-if="!errors.length" :description="emptyDescription" />
    </el-card>
  </div>
</template>

<script setup>
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { 
  DataLine, 
  Refresh, 
  Document, 
  Timer, 
  CircleClose,
  TrendCharts,
  WarningFilled,
  ArrowLeft,
  Grid
} from '@element-plus/icons-vue'
import * as echarts from 'echarts'
import api from '@/utils/api'

const router = useRouter()
const loading = ref(false)
const trendChartRef = ref(null)
let trendChart = null

// 时间范围
const selectedTimeRange = ref('all')
const dateRange = ref([])
const startTime = ref('00:00:00')
const endTime = ref('23:59:59')

// 概览数据
const overview = ref({
  total_logs: 0,
  total_jobs: 0,
  error_count: 0,
  warn_count: 0,
  info_count: 0,
  error_rate: 0
})

// 类健康度数据
const classHealth = ref([])

// 日志趋势数据
const trendData = ref([])

// 趋势粒度标签
const trendGranularityLabel = ref('按小时')

// 错误数据（所有级别）
const allErrors = ref({
  ERROR: [],
  WARN: [],
  EXCEPTION: []
})

// 日志级别选择
const selectedLogLevel = ref('ERROR')

// 当前显示的错误数据
const errors = computed(() => {
  return allErrors.value[selectedLogLevel.value] || []
})

// 返回上一页
const goBack = () => {
  router.back()
}

// 格式化数字
const formatNumber = (num) => {
  if (!num) return '0'
  if (num >= 1000000) return (num / 1000000).toFixed(1) + 'M'
  if (num >= 1000) return (num / 1000).toFixed(1) + 'K'
  return num.toString()
}

// 获取概览统计
const fetchOverview = async () => {
  try {
    const response = await api.get('/logs/flink-job/overview', {
      params: getTimeRangeParams()
    })
    
    if (response.data.success) {
      overview.value = response.data.data
    }
  } catch (error) {
    ElMessage.error('获取概览统计失败: ' + (error.response?.data?.message || error.message))
  }
}

// 获取类健康度排行
const fetchClassHealth = async () => {
  try {
    const response = await api.get('/logs/flink-job/jobs/health', {
      params: getTimeRangeParams()
    })
    
    if (response.data.success) {
      classHealth.value = response.data.data.classes || []
    }
  } catch (error) {
    // 静默处理
  }
}

// 根据时间范围自动选择合适的粒度
const getGranularity = () => {
  switch (selectedTimeRange.value) {
    case 'all':
      trendGranularityLabel.value = '按天'
      return 'day'
    case '1h':
      trendGranularityLabel.value = '按分钟'
      return 'minute'
    case '1d':
      trendGranularityLabel.value = '按小时'
      return 'hour'
    case '3d':
      trendGranularityLabel.value = '按小时'
      return 'hour'
    case '7d':
      trendGranularityLabel.value = '按天'
      return 'day'
    case 'custom':
      if (dateRange.value && dateRange.value.length === 2) {
        const start = new Date(dateRange.value[0])
        const end = new Date(dateRange.value[1])
        const diffDays = (end - start) / (1000 * 60 * 60 * 24)
        
        if (diffDays <= 1) {
          trendGranularityLabel.value = '按小时'
          return 'hour'
        } else if (diffDays <= 7) {
          trendGranularityLabel.value = '按小时'
          return 'hour'
        } else {
          trendGranularityLabel.value = '按天'
          return 'day'
        }
      }
      trendGranularityLabel.value = '按小时'
      return 'hour'
    default:
      trendGranularityLabel.value = '按小时'
      return 'hour'
  }
}

// 获取日志趋势
const fetchTrend = async () => {
  try {
    const granularity = getGranularity()
    
    const response = await api.get('/logs/flink-job/trend', {
      params: {
        ...getTimeRangeParams(),
        granularity: granularity
      }
    })
    
    if (response.data.success) {
      trendData.value = response.data.data.trends || []
      renderTrendChart()
    }
  } catch (error) {
    // 静默处理
  }
}

// 获取错误分析（一次性获取所有级别）
const fetchErrors = async () => {
  try {
    const response = await api.get('/logs/flink-job/errors', {
      params: {
        ...getTimeRangeParams(),
        top_n: 20
      }
    })
    
    if (response.data.success) {
      allErrors.value = response.data.data.errors_by_level || {
        ERROR: [],
        WARN: [],
        EXCEPTION: []
      }
    }
  } catch (error) {
    // 静默处理
  }
}

// 切换日志级别（不需要重新请求）
const switchLogLevel = (level) => {
  selectedLogLevel.value = level
}

// 计算属性：根据日志级别显示不同的标题和标签
const errorAnalysisTitle = computed(() => {
  const titles = {
    'ERROR': '错误分析',
    'WARN': '警告分析',
    'EXCEPTION': '异常分析'
  }
  return titles[selectedLogLevel.value] || '错误分析'
})

const logCountLabel = computed(() => {
  const labels = {
    'ERROR': '错误次数',
    'WARN': '警告次数',
    'EXCEPTION': '异常次数'
  }
  return labels[selectedLogLevel.value] || '错误次数'
})

const logMessageLabel = computed(() => {
  const labels = {
    'ERROR': '错误消息',
    'WARN': '警告消息',
    'EXCEPTION': '异常消息'
  }
  return labels[selectedLogLevel.value] || '错误消息'
})

const emptyDescription = computed(() => {
  const descriptions = {
    'ERROR': '暂无错误数据',
    'WARN': '暂无警告数据',
    'EXCEPTION': '暂无异常数据'
  }
  return descriptions[selectedLogLevel.value] || '暂无数据'
})

// 渲染趋势图
const renderTrendChart = () => {
  if (!trendChartRef.value || !trendData.value.length) return
  
  if (!trendChart) {
    trendChart = echarts.init(trendChartRef.value)
  }
  
  // 提取所有日志级别
  const logLevels = new Set()
  trendData.value.forEach(item => {
    Object.keys(item).forEach(key => {
      if (key !== 'time') {
        logLevels.add(key)
      }
    })
  })
  
  const times = trendData.value.map(item => item.time)
  
  // 定义日志级别的颜色和顺序
  const levelConfig = {
    'ERROR': { color: '#f56c6c', order: 1 },
    'WARN': { color: '#e6a23c', order: 2 },
    'INFO': { color: '#409eff', order: 3 },
    'DEBUG': { color: '#67c23a', order: 4 }
  }
  
  // 按顺序生成系列数据
  const series = Array.from(logLevels)
    .sort((a, b) => (levelConfig[a]?.order || 999) - (levelConfig[b]?.order || 999))
    .map(level => ({
      name: level,
      type: 'line',
      smooth: true,
      itemStyle: {
        color: levelConfig[level]?.color || '#909399'
      },
      data: trendData.value.map(item => item[level]?.log_count || 0)
    }))
  
  const option = {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross'
      }
    },
    legend: {
      data: Array.from(logLevels).sort((a, b) => (levelConfig[a]?.order || 999) - (levelConfig[b]?.order || 999)),
      bottom: 0
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '15%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: times,
      axisLabel: {
        rotate: 45,
        formatter: (value) => {
          const granularity = getGranularity()
          if (granularity === 'minute') {
            return value.slice(11, 16)
          } else if (granularity === 'hour') {
            return value.slice(11, 13) + '时'
          } else {
            return value.slice(5, 10)
          }
        }
      }
    },
    yAxis: {
      type: 'value',
      name: '日志数'
    },
    series: series
  }
  
  trendChart.setOption(option)
}

// 刷新数据
const refreshData = async () => {
  loading.value = true
  try {
    await Promise.all([
      fetchOverview(),
      fetchClassHealth(),
      fetchTrend(),
      fetchErrors()
    ])
    ElMessage.success('数据刷新成功')
  } catch (error) {
    ElMessage.error('刷新数据失败')
  } finally {
    loading.value = false
  }
}

// 快捷时间范围选择
const selectTimeRange = (range) => {
  selectedTimeRange.value = range
  dateRange.value = []
  startTime.value = '00:00:00'
  endTime.value = '23:59:59'
  
  refreshData()
}

// 自定义时间范围改变
const handleCustomTimeChange = () => {
  if (dateRange.value && dateRange.value.length === 2) {
    selectedTimeRange.value = 'custom'
    refreshData()
  }
}

// 格式化日期为本地时间字符串
const formatLocalDateTime = (date) => {
  const year = date.getFullYear()
  const month = String(date.getMonth() + 1).padStart(2, '0')
  const day = String(date.getDate()).padStart(2, '0')
  const hours = String(date.getHours()).padStart(2, '0')
  const minutes = String(date.getMinutes()).padStart(2, '0')
  const seconds = String(date.getSeconds()).padStart(2, '0')
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}

// 获取时间范围参数
const getTimeRangeParams = () => {
  if (selectedTimeRange.value === 'all') {
    return {}
  }
  
  if (dateRange.value && dateRange.value.length === 2) {
    const start = `${dateRange.value[0]} ${startTime.value || '00:00:00'}`
    const end = `${dateRange.value[1]} ${endTime.value || '23:59:59'}`
    return {
      start_time: start,
      end_time: end
    }
  }
  
  const now = new Date()
  const end = formatLocalDateTime(now)
  let start = ''
  
  switch (selectedTimeRange.value) {
    case '1h':
      start = formatLocalDateTime(new Date(now.getTime() - 60 * 60 * 1000))
      break
    case '1d':
      start = formatLocalDateTime(new Date(now.getTime() - 24 * 60 * 60 * 1000))
      break
    case '3d':
      start = formatLocalDateTime(new Date(now.getTime() - 3 * 24 * 60 * 60 * 1000))
      break
    case '7d':
      start = formatLocalDateTime(new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000))
      break
  }
  
  return start ? { start_time: start, end_time: end } : {}
}

// 获取健康状态标签类型
const getHealthTagType = (status) => {
  const typeMap = {
    'healthy': 'success',
    'warning': 'warning',
    'critical': 'danger'
  }
  return typeMap[status] || 'info'
}

// 获取健康状态标签文本
const getHealthLabel = (status) => {
  const labelMap = {
    'healthy': '健康',
    'warning': '警告',
    'critical': '严重'
  }
  return labelMap[status] || '未知'
}

// 页面加载时获取数据
onMounted(() => {
  refreshData()
  
  // 监听窗口大小变化
  window.addEventListener('resize', () => {
    if (trendChart) {
      trendChart.resize()
    }
  })
})
</script>

<style scoped>
.flink-job-logs {
  padding: 0;
}

/* 页面头部布局 */
.title-with-back {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.blue-return-button {
  background: linear-gradient(135deg, #409eff 0%, #66b3ff 100%);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
  transition: all 0.3s ease;
  flex-shrink: 0;
  margin-top: 2px;
}

.blue-return-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(64, 158, 255, 0.4);
  background: linear-gradient(135deg, #66b3ff 0%, #409eff 100%);
}

.title-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 卡片header样式 */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  color: #303133;
}

.card-header .el-icon {
  font-size: 16px;
  color: #606266;
}

.filter-card {
  margin-bottom: 16px;
}

.time-selector {
  display: flex;
  align-items: center;
  gap: 16px;
}

.time-quick-buttons {
  display: flex;
  gap: 8px;
}

/* 时间按钮基础样式 */
.time-btn {
  border: 2px solid;
  font-weight: 500;
  transition: all 0.3s ease;
}

/* 全部 - 灰色 */
.time-btn-all {
  border-color: #909399;
  color: #606266;
  background-color: #f4f4f5;
}

.time-btn-all:hover {
  border-color: #909399;
  color: #606266;
  background-color: #e9e9eb;
}

.time-btn-all.active {
  border-color: #909399;
  color: #fff;
  background-color: #909399;
}

/* 1小时 - 紫色 */
.time-btn-1h {
  border-color: #9b59b6;
  color: #9b59b6;
  background-color: #f3e8ff;
}

.time-btn-1h:hover {
  border-color: #9b59b6;
  color: #9b59b6;
  background-color: #e6d5f5;
}

.time-btn-1h.active {
  border-color: #9b59b6;
  color: #fff;
  background-color: #9b59b6;
}

/* 1天 - 蓝色 */
.time-btn-1d {
  border-color: #409eff;
  color: #409eff;
  background-color: #ecf5ff;
}

.time-btn-1d:hover {
  border-color: #409eff;
  color: #409eff;
  background-color: #d9ecff;
}

.time-btn-1d.active {
  border-color: #409eff;
  color: #fff;
  background-color: #409eff;
}

/* 3天 - 橙色 */
.time-btn-3d {
  border-color: #e6a23c;
  color: #e6a23c;
  background-color: #fdf6ec;
}

.time-btn-3d:hover {
  border-color: #e6a23c;
  color: #e6a23c;
  background-color: #faecd8;
}

.time-btn-3d.active {
  border-color: #e6a23c;
  color: #fff;
  background-color: #e6a23c;
}

/* 7天 - 绿色 */
.time-btn-7d {
  border-color: #67c23a;
  color: #67c23a;
  background-color: #f0f9ff;
}

.time-btn-7d:hover {
  border-color: #67c23a;
  color: #67c23a;
  background-color: #e1f3d8;
}

.time-btn-7d.active {
  border-color: #67c23a;
  color: #fff;
  background-color: #67c23a;
}

.custom-time-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.overview-row {
  margin-bottom: 16px;
}

.stat-card {
  height: 130px;
}

.stat-content {
  display: flex;
  padding: 10px;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
}

.stat-icon.logs {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.jobs {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.errors {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-icon.rate {
  background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
  color: #303133;
  line-height: 1.2;
  margin-bottom: 2px;
}

.stat-label {
  font-size: 13px;
  color: #909399;
  margin-top: 4px;
  white-space: nowrap;
}

.job-health-card,
.trend-chart-card,
.errors-card {
  margin-bottom: 16px;
}

/* 日志级别切换按钮样式 */
.level-tabs {
  display: flex;
  gap: 8px;
}

.level-tabs .el-button {
  font-weight: 500;
  transition: all 0.3s;
  min-width: 70px;
}

.level-tabs .el-button.level-active {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* EXCEPTION 按钮激活状态 */
.level-tabs .el-button.exception-btn {
  background: linear-gradient(135deg, #9c27b0 0%, #ba68c8 100%);
  border-color: #9c27b0;
  color: white;
}

.level-tabs .el-button.exception-btn:hover {
  background: linear-gradient(135deg, #ba68c8 0%, #9c27b0 100%);
}

/* 页面头部样式 */
.page-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 20px 24px;
  border-radius: 12px;
  overflow: hidden;
  color: #303133;
  min-height: 120px;
  border: 1px solid #e4e7ed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.page-title {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  flex: 1;
}

.title-icon .icon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.title-icon .icon-container:hover {
  transform: scale(1.05);
}

.title-main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.title-main h2 {
  font-size: 20px;
  font-weight: 600;
  color: #303133;
  margin: 0;
  letter-spacing: -0.3px;
}

.page-description {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #606266;
  margin: 0 0 8px 0;
}
</style>

